package br.quest.activities;

import br.quest.R;
import br.quest.utils.TaskThread;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.animation.AnimationUtils;
import android.widget.ProgressBar;

public class SplashActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.splash);
        ProgressBar progress = (ProgressBar) findViewById(R.id.progress);
        progress.startAnimation(AnimationUtils.loadAnimation(this, R.anim.anim_spinner));

        TaskThread iniciar = new TaskThread() {
            public void executar() {
                try {
                    wait(1500);
                } catch (InterruptedException e) {
                }
            }

            public void onFinish() {
                startActivity(new Intent(SplashActivity.this, MainActivity.class));
            }

            public void onError(Exception ex) {
                startActivity(new Intent(SplashActivity.this, MainActivity.class));
            }
        };
        iniciar.start();

        // Carregar as funções principais aqui, criar um novo thread pra isso, possivelmente uma classe parecida com a
        // ProgressThread.
    }
}
